package com.helloniu.core.confmgr;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

/**
 * HttpActionController.
 *
 * @version   0.1.1
 * @author    Yuan Yuan
 */
public class ConfMgrController extends MultiActionController {
    public ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception {        
        String email = (String) request.getParameter("email");
        String pwd = (String) request.getParameter("password");
        System.out.println("do login: " + email +"|"+ pwd);

        // 登录成功
        // 数据库校验
        // 页面跳转，参数传入
        //ModelAndView mav = new ModelAndView("userspec.html");
        //mav.addObject("username", email);
        boolean test = false;
        
        if(!test) {
            ModelAndView mav = new ModelAndView("userspec");
            mav.addObject("username", email);
            return mav;    
        }        
        else {
            ModelAndView mav = new ModelAndView("ftltest");
            mav.addObject("springstatusexpression", "springstatuse中文xpression111");
            return mav;
        }
        
    }
    
    public ModelAndView doRegister(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String email = (String) request.getParameter("email");
        String pwd = (String) request.getParameter("password");
        System.out.println("do register: " + email +"|"+ pwd);
        // 存数据库
        
        return null;
    }
}